package network;

import java.util.concurrent.PriorityBlockingQueue;
import packet.CommandRequest;

/**
 * Network proxy that holds connection objects to client
 * @author Joel Garboden
 */
public class NetQProxy
{
  public String playerName;
  private boolean active;
  private Thread in;
  private Thread out;
  public PriorityBlockingQueue<CommandRequest> queue;

  /**
   * Constructor
   * @param in either Net2QRunnable or Q2NetRunnable depending on network side
   * @param out opposite of in's object type
   * @param outQ outgoing packet queue
   */
  public NetQProxy(Thread in, Thread out, PriorityBlockingQueue<CommandRequest> outQ)
  {
    active = true;
    this.in = in;
    this.out = out;
    queue = outQ;
  }

  /**
   * Mutator
   * @param active activity state
   */
  public void setActive(boolean active)
  {
    this.active = active;
  }

  /**
   * Accessor
   * @return activity state
   */
  public boolean isActive()
  {
    return active;
  }

  /**
   *
   * @param playerName
   */
  public void setPlayerName(String playerName)
  {
    this.playerName = playerName;
  }

  /**
   *
   * @return
   */
  public String getPlayerName()
  {
    return playerName;
  }
}
